package com.shujia.mm.udf;

import com.aliyun.odps.udf.UDFException;
import com.aliyun.odps.udf.UDTF;
import com.aliyun.odps.udf.annotation.Resolve;

import java.io.IOException;


@Resolve({"string,string->string"})
public class MyUDTF2 extends UDTF {

    /**
     * 对一列数据进行根据分隔符进行切分
     * select("hello,hello,world",",") =>
     */
    @Override
    public void process(Object[] objects) throws UDFException, IOException {
        String str = (String) objects[0];
//        System.out.println(str);
        String regex = (String) objects[1];
//        System.out.println(regex);
        String[] split = str.split(regex);
        for (String word : split) {
            forward(word);
        }
    }
}
